package com.dm.mcode.view;

import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import com.dm.mcode.util.Logger;

import rx.Subscription;

/**
 * Created by Damon.Han on 2016/10/10 0010.
 */

public class BaseActivity extends AppCompatActivity {
    protected Subscription subscription;

    @Override
    protected void onDestroy() {
        super.onDestroy();
        unsubscribe();
    }

    protected void unsubscribe() {
        if (subscription != null && !subscription.isUnsubscribed()) {
            subscription.unsubscribe();
        }
    }

    public void showTip(String tip) {
        Toast.makeText(this, tip, Toast.LENGTH_SHORT).show();
    }

    public void logOutput(String tip) {
        Logger.d(tip);
    }
}
